<!DOCTYPE HTML>
<html>

<head>
    <meta name="layout" content="main_mobile">
    <link rel="stylesheet" href="${resource(dir: 'css', file: 'donate.css')}" type="text/css">
    <title>火堆</title>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>	
</head>

<body>
<input type="hidden"  id="descriptionTip" value="${subproject?.subdescription}"/>
<input type="hidden"  id="nameTip" value="${project.name}"/>
<script type="text/javascript">
	    wx.config({
	 	    debug: false,  // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
	 	    appId: '${appid}', // 必填，公众号的唯一标识
	 	    timestamp: "${timestamp}", // 必填，生成签名的时间戳
	 	    nonceStr: '${nonceStr}', // 必填，生成签名的随机串
	 	    signature: '${signature}',// 必填，签名，见附录1
	 	    jsApiList: ['checkJsApi' , 'onMenuShareAppMessage' , 'onMenuShareTimeline']
	 	});

	 	wx.ready(function(){
	 		wx.checkJsApi({
	 		    jsApiList: ['onMenuShareAppMessage' , 'onMenuShareTimeline'], // 需要检测的JS接口列表，所有JS接口列表见附录2,
	 		    success: function(res) {
	 		       //alert('wx.check: '+JSON.stringify(res));
	 		    }
	 		});
	 		//发送给朋友分享功能
	 		wx.onMenuShareAppMessage({
	 		    title: $("#nameTip").val()+"—火堆公益", // 分享标题
	 		    desc: $("#descriptionTip").val(), // 分享描述
	 		    link: '${shareUrl}', // 分享链接
	 		    imgUrl: '${imgUrl}', // 分享图标
				trigger: function () {
				//alert("点击按钮");
				},
	 		    success: function () { 
	 		        // 用户确认分享后执行的回调函数
	 		        window.location.href = "/scfire/subProject/subProjectDetail?subprojectid="+${subproject.id}
	 		    },
	 		    cancel: function () { 
	 		        // 用户取消分享后执行的回调函数
	 		    }
	 		});

	 		//分享到朋友圈
	 		wx.onMenuShareTimeline({
	 		    title: '邀您一起支持【${user.nickname}】发起的【'+$("#nameTip").val()+'】的公益筹款，小伙伴们快来一起支持他的善行。', // 分享标题
	 		    link: '${shareUrl}', // 分享链接
	 		    imgUrl: '${imgUrl}',  // 分享图标
	 		    success: function () { 
	 		        // 用户确认分享后执行的回调函数
	 		        window.location.href = "/scfire/subProject/subProjectDetail?subprojectid="+${subproject.id}
	 		    },
	 		    cancel: function () { 
	 		        // 用户取消分享后执行的回调函数
	 		    }
	 		});

	 	});
	 	wx.error(function (res) {
			//alert('wx.error: '+JSON.stringify(res));
	    });
	</script>
	<div class="top-banner">
       	 点击右上角，发送给朋友创建一起捐！<img class="share" src="../images/ic-share.png" alt="">
    </div>
	<div class="backdrop active"></div>
	
    <section class="ui-container">
		<div class="top-info">
			<div class="top">
				<img class="img-top" src="../images/img-yqj-top-bg.png" alt="">
				<div class="wrap">
					<a href="#" class="ui-avatar"> <g:if
							test="${user?.headimgurl!=null }">
							<span style="background-image:url(${user.headimgurl})"></span>
						</g:if> <g:else>
							<span
								style="background-image:url(${resource(dir: 'images/demo', file: 'demo-avatar-1.jpg')})"></span>
						</g:else>
					</a>
					<h4>
<%--						<g:if test="${user.verify == 'pass'}">--%>
<%--							${user.realName }--%>
<%--						</g:if>--%>
<%--						<g:else>--%>
							${user.nickname }
<%--						</g:else>--%>
						邀你一起捐
					</h4>
				</div>
			</div>
			<p>
				${subproject.subdescription }
			</p>
		</div>

		<div class="banner-wrap style1">
			<img src="../images/img-invite.png" alt="">
			<g:render template="processBanner"  model="['fRuler':fRuler,'subproject':subproject,'donateUsers':donateUsers,'subFDonates':subFDonates]"></g:render>
		</div>
		<div class="banner-wrap style2">
			<g:render template="projectStatsBanner" bean="${project}"></g:render>
			<div class=" project">
				<div class="ui-box">
					<div class="ui-list-thumb">
						<span
							style="background-image:url(/scfire/project/imgRead?img=${project.img})"></span>
					</div>
					<div class="ui-list-info">
						<h4 class="ui-nowrap">
							${project.name}
						</h4>
						<p>
							${project.description}
						</p>
					</div>
				</div>
				<p class="msg">善款接收：上海真爱梦想公益基金会</p>
				<div class="detail" id="projectDetail"> 
					<input type="hidden" value="${project.detail }" id="projectDetailHtml">
			        	<script type="text/javascript">
							$("#projectDetail").html($("#projectDetailHtml").val());
			        	</script>
			       	<g:each in="${project.projectPics}" var="projectPic">
			       			<img class="img-detail" src="/scfire/project/imgRead?img=${projectPic.pic}" alt="">
				            <p class="ui-txt-tips content" >${projectPic.content}</p>
			       	</g:each>
			       	</div>
				<div class="btn-container">
					<div class="btn btn-detail">
						项目详情<i class="icon-down"></i>
					</div>
				</div>
			</div>
		</div>
		<g:render template="footerscfire" contextPath="/project"/>  
	</section>
    <script>
    var requstFlag = false;
    $(function() {
        $('.p-tag-list .p-tag').click(function() {
            $(this).addClass('active').siblings('.p-tag').removeClass('active');
            $('.donate-form .input-box').removeClass('active');
        });

        $('.donate-form .input-box input').click(function() {
            $('.p-tag-list .p-tag').removeClass('active');
            $(this).parent().addClass('active');
        });

        $('.dialog-step .dialog-box .btn-close').click(function() {
            $('.dialog-step').removeClass('show');
        });
        $('.btn-detail').on('click',function(){
  	       if($(this).hasClass('active')){
  	            $(this).removeClass('active').parent('.btn-container').siblings('.detail').removeClass('active');
  	        }else{
  	            $(this).addClass('active').parent('.btn-container').siblings('.detail').addClass('active');
  	          
  	        }
  	       
  	   });
    })

    function getRequst(url, id){
		 $.ajax({
			  url: url,
			  success: function (response){
				  console.log("succuss" + id);
				  
				  $(id).html(response);
			  },
			  dataType: "html",
			  error: function (){
				  console.log("error");
				  $(id).html("请求出错，请稍后刷新重试");
			  }
			});
	}
    function showDeal() {
        $('.dialog-step').addClass('show');
        return false;
    }

    </script>
</body>

</html>
